/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__cicsts_destroy_packet.c                         */
/*  NOTE      =                                                    */
/*  DATE      = 2016/05/03 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>

#include "frcomm.h"
#include "frmem.h"

#include <cicsts/config.h>
#include <cicsts/cicsts_core.h>

void __cicsts_destroy_packet(L7_cicsts_packet **pp_st_cicsts_packet);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{
    L7_cicsts_packet *p_st_cicsts_packet = NULL;
    p_st_cicsts_packet = (L7_cicsts_packet *) frmalloc(sizeof(L7_cicsts_packet));
    CU_ASSERT_PTR_NOT_NULL(p_st_cicsts_packet);
    memset(p_st_cicsts_packet, 0x00, sizeof(L7_cicsts_packet));

    __cicsts_destroy_packet(&p_st_cicsts_packet);
    CU_ASSERT_PTR_NULL(p_st_cicsts_packet);
}

static void __case2(void)
{
    L7_cicsts_packet *p_st_cicsts_packet = NULL;
    __cicsts_destroy_packet(&p_st_cicsts_packet);
    CU_ASSERT_PTR_NULL(p_st_cicsts_packet);
}

int add_suite__cicsts_destroy_packet(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __cicsts_destroy_packet()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL ||
        CU_add_test(pSuite, "case2", __case2) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
